﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using JM.JCY.Common;

namespace JM.JCY.SharePointComponent.Document.ViewAllDocuments
{
    public partial class ViewAllDocumentsUserControl : UserControl
    {
        string listName = JCYConstant.SharePointListName.PublicDocumentLibrary;
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                SPWeb web = SPContext.Current.Web;
                SPList survey = web.Lists[listName];
                this.lvDocument.ListId = survey.ID.ToString();
                lvDocument.ViewId = survey.Views["All"].ID.ToString();
                string onclick = string.Format("javascript:NewItem2(event, '{0}');javascript:return false;", survey.DefaultNewFormUrl);
                this.idHomePageNewItem.Attributes.Add("onclick", onclick);

                if (CommonFunction.IsApplicationAdmin(11))
                    this.idHomePageNewItem.Visible = true;
                else
                    this.idHomePageNewItem.Visible = false;

            }


        }
    }
}
